@import "../../themes/ionic.globals.md";

// Material Design Segment
// --------------------------------------------------

$segment-button-md-text-color-activated:       $toolbar-md-active-color !default;
$segment-button-md-border-color-activated:     $toolbar-md-active-color !default;

$segment-button-md-border-bottom-width:        2px !default;
$segment-button-md-border-bottom-color:        rgba(#000, .10) !default;

$segment-button-md-opacity:                    .7 !default;
$segment-button-md-opacity-activated:          1 !default;
$segment-button-md-opacity-disabled:           .3 !default;

$segment-button-md-padding:                    0 6px !default;
$segment-button-md-height:                     4.2rem !default;
$segment-button-md-line-height:                4rem !default;
$segment-button-md-font-size:                  1.2rem !default;
$segment-button-md-icon-size:                  2.6rem !default;
$segment-button-md-icon-line-height:           $segment-button-md-line-height !default;


.segment-md .segment-button {
  flex: 1;

  padding: $segment-button-md-padding;

  width: 0;
  height: $segment-button-md-height;

  border-bottom-width: $segment-button-md-border-bottom-width;
  border-bottom-style: solid;
  border-bottom-color: $segment-button-md-border-bottom-color;

  font-size: $segment-button-md-font-size;
  font-weight: 500;
  line-height: $segment-button-md-line-height;
  text-transform: uppercase;

  color: $segment-button-md-text-color-activated;
  background-color: transparent;
  opacity: $segment-button-md-opacity;
  transition: 100ms all linear;

  ion-icon {
    font-size: $segment-button-md-icon-size;
    line-height: $segment-button-md-icon-line-height;
  }

  &.activated,
  &.segment-activated {
    border-color: $segment-button-md-border-color-activated;
    opacity: $segment-button-md-opacity-activated;
  }
}

.segment-md .segment-button-disabled {
  opacity: $segment-button-md-opacity-disabled;

  pointer-events: none;
}

.toolbar {

  .segment-md {
    margin: 0 auto;
  }

  .segment-md .segment-button.activated,
  .segment-md .segment-button.segment-activated {
    opacity: 1;
  }

}


// Material Design Segment Button Mixin
// --------------------------------------------------

@mixin md-segment-button($color-name, $color-base, $color-contrast) {

  .segment-md-#{$color-name} .segment-button {
    color: $color-base;

    &.activated,
    &.segment-activated {
      border-color: $color-base;
      color: $color-base;
      opacity: 1;
    }
  }

}


// Material Design Segment Color Generation
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
  @include md-segment-button($color-name, $color-base, $color-contrast);
}
